<template>
	<el-dialog v-model="state.dialog.isShowDialog" :close-on-click-modal="false" title="场景日志" draggable width="50%">
		<div class="layout-padding-auto layout-padding-view">
			<el-table
				:data="state.dataList"
				v-loading="state.loading"
				style="width: 100%"
				border
				:cell-style="tableStyle.cellStyle"
				:header-cell-style="tableStyle.headerCellStyle"
			>
				<el-table-column type="index" label="#" width="60" />
				<el-table-column prop="sceneName" label="场景名称" />
				<el-table-column label="状态" width="90">
					<template #default="scope">
						<el-tag type="success" v-if="scope.row.status == '1'">成功</el-tag>
						<el-tag type="danger" v-if="scope.row.status == '0'">失败</el-tag>
					</template>
				</el-table-column>
				<el-table-column prop="info" label="描述" />
				<el-table-column prop="happenTime" label="触发时间" />
				<el-table-column prop="remarks" label="备注" />
			</el-table>
			<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
		</div>
	</el-dialog>
</template>
<script setup lang="ts" name="job-log">
import { BasicTableProps, useTable } from '/@/hooks/table';
import { getLog } from '/@/api/scene/sceneLinkage';
const state: BasicTableProps = reactive<BasicTableProps>({
	queryForm: {
		linkageId: '',
	},
	dialog: {
		isShowDialog: false,
	},
	pageList: getLog,
});
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state);
const openDialog = (id: string) => {
	state.dialog.isShowDialog = true;
	state.queryForm.linkageId = id;
	getDataList();
};
// 暴露变量
defineExpose({
	openDialog,
});
</script>
<style scoped></style>
